﻿/*
 * File Name:               UIListEditor.cs
 *
 * Description:             普通类
 * Author:                  lisiyu
 * Create Date:             2016/05/23
 */

using System.Collections.Generic;
using UnityEngine;

namespace UnityEditor.UGUI
{
    [CustomEditor(typeof(UIListContainer), true)]
    public class UIListEditor : Editor
    {
        private GameObject mObjCell;
        private int mNum;

        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            GUILayout.Label("--------------");
            mObjCell = EditorGUILayout.ObjectField(mObjCell, typeof(GameObject), true) as GameObject;
            mNum = EditorGUILayout.IntField(mNum);
            if (GUILayout.Button("测试效果"))
            {
                var sc = this.target as UIListContainer;
                var cells = new List<UIListCell>();
                for (int i = 0; i < mNum; i++)
                {
                    var cell = new UIListCell();
                    cell.setPrefab(mObjCell);
                    cells.Add(cell);
                }
                sc.setDatas(cells);
                sc.display();
            }
        }
    }
}